package com.github.aloxc.plugin.restplus.listener;

import com.github.aloxc.plugin.restplus.component.Dialog;
import com.github.aloxc.plugin.restplus.component.JsonToolForm;
import com.github.aloxc.plugin.restplus.i18n.I18Bundle;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.IconLoader;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 *
 * @author leero
 */
public class JsonToolActionListener implements ActionListener {
    private Project project;

    public JsonToolActionListener(Project project){
        this.project = project;
    }



    @Override
    public void actionPerformed(ActionEvent e) {


        JsonToolForm jsonToolForm = new JsonToolForm(project);
        int height = 640;
        int width = 900;
        jsonToolForm.setMaximumSize(new Dimension(width,height));
        jsonToolForm.setMinimumSize(new Dimension(width,height));
        jsonToolForm.setPreferredSize(new Dimension(width,height));

        Dialog dialog = new Dialog(null, jsonToolForm,
                new Dimension(width,height),
                new Dimension(width,height),
                new Dimension(width,height),
                IconLoader.getIcon("/icons/json.png"),
                I18Bundle.getMessage("com.github.aloxc.plugin.restplus.toolbar.tools.json.text")
        );
        try {
            dialog.setVisible(true);
        }catch (Exception xe){

        }
    }
}
